<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta
			name="viewport"
			content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
		/>
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<title>baiteda</title>
		<link rel="icon" href="./inco.ico" />
		<style>
			body {
				margin: 0;
				padding: 0;
				background-color: #f0f2f6;
				font-family: 'Helvetica Neue', 'Helvetica', 'Arial', 'PingFang SC',
					'Hiragino Sans GB', 'Microsoft YaHei', 'STHeiti', 'SimHei', sans-serif;
			}

			body * {
				box-sizing: border-box;
			}

			header {
				height: 65px;
				background-color: #fff;
			}

			header .logo {
				margin-left: 40px;
				display: flex;
				align-items: center;
				width: 146px;
				height: 100%;
				line-height: 65px;
			}

			header .logo img {
				height: 30px;
			}

			main {
				display: flex;
				flex-direction: column;
				align-items: center;
				padding: 28px 60px;

				position: absolute;
				width: 460px;
				min-height: 440px;
				left: calc(50% - 460px / 2);
				top: calc(50% - 440px / 2);

				background: #fff;
				box-shadow: 0px 8px 20px rgba(86, 130, 255, 0.08);
				border-radius: 8px;
			}

			#service-state {
				text-align: center;
			}

			#service-state .diamond {
				height: 130px;
				margin-bottom: 40px;
			}

			#service-state h1 {
				margin: 12px;
				color: #303142;
				font-size: 24px;
				font-weight: 600;
				line-height: 32px;
				letter-spacing: 0.8px;
			}

			#service-state .operate {
				display: block;
				padding: 8px 12px;
				height: 34px;
				line-height: 1;
				border: 1px solid #dee0e3;
				border-radius: 4px;
				text-decoration: unset;
			}

			div hr {
				margin: 15px 0 8px;
			}

			#service-state .operate .operate-text {
				color: #8f959e;
				font-weight: 500;
				font-size: 14px;
			}

			#service-state .operate:hover {
				border-color: #658bfc;
			}

			#service-state .operate:hover .operate-text {
				color: #658bfc;
			}

			#service-state .operate:active {
				border-color: #466feb;
			}

			#service-state .operate:active .operate-text {
				color: #466feb;
			}

			hr {
				margin: 20px 0 8px;
				width: 100%;
				border: 1px solid #e8eaed;
			}

			#service-tips {
				font-size: 12px;
				line-height: 20px;
				color: #646a73;
			}

			#service-tips p {
				margin: 4px 0;
			}

			#service-tips p.indent {
				text-indent: 2em;
			}

			#service-tips .reasons {
				margin-top: 0;
			}
		</style>
	</head>

	<body style="visibility: hidden">
		<div id="default_overdue">
			<main>
				<section id="service-state">
					<div class="diamond">
						<img src="./images/noAccess.svg" />
					</div>
					<h1 class="i18n" data-i18n="title">无法访问当前页面</h1>
				</section>
				<hr />
				<section id="service-tips">
					<article>
						<p class="i18n" data-i18n="respectfully">尊敬的用户：</p>
						<p class="indent i18n" data-i18n="warnTip">
							您可联系服务管理员获取解决办法，可能的问题原因：
						</p>
						<ul class="reasons">
							<li class="i18n" data-i18n="reason">页面授权时间已到</li>
							<li class="i18n" data-i18n="reason2">管理员未授权您访问页面</li>
						</ul>
					</article>
				</section>
			</main>
		</div>
		<div id="showmore_overdue" style="display: none">
			<header>
				<div class="logo">
					<img src="./images/logo.svg" />
				</div>
			</header>
			<main>
				<section id="service-state">
					<div class="diamond">
						<img src="./images/diamond.svg" />
					</div>
					<h1 class="i18n" data-i18n="title">服务已到期</h1>
					<!-- <a class="operate" href="javascript:void(0);" onclick="linkTo()">
                    <span class="operate-text i18n" data-i18n="price">
                        查看版本与定价
                    </span>
                </a> -->
				</section>
				<hr />
				<section id="service-tips">
					<article>
						<p class="i18n" data-i18n="respectfully">尊敬的用户：</p>
						<p class="indent i18n ptmN" data-i18n="warnTip">
							您好！目前产品版本的服务已到期，如需购买或延长服务期，请联系我们：
						</p>
						<p class="indent i18n ptmY" data-i18n="warnTip">
							您好！目前产品版本的服务已到期，如需购买或延长服务期，请联系管理员。
						</p>
						<ul class="reasons phoneAndMail">
							<li class="i18n" data-i18n="phone">服务热线：400-1818-187</li>
							<li class="i18n" data-i18n="email">
								客服邮箱：service@byteluck.com
							</li>
						</ul>
					</article>
				</section>
			</main>
		</div>
	</body>
	<!-- <script src="//cdn.jsdelivr.net/npm/eruda"></script>
	<script>
		eruda.init()
	</script> -->
	<script>
		let i18nInfo = {
			zh: {
				title: '无法访问当前页面',
				respectfully: '尊敬的用户：',
				warnTip: '您可联系服务管理员获取解决办法，可能的问题原因：',
				reason: '页面授权时间已到',
				reason2: '管理员未授权您访问页面',
			},
			en: {
				title: 'Service Expired',
				respectfully: 'Dear user:',
				warnTip:
					'You can contact the service administrator for a solution, possible causes of the problem:',
				reason: 'The page authorization time has come',
				reason2:
					'Your administrator has not authorized you to access this page',
			},
			ja: {
				title: 'サービスの有効期限',
				respectfully: '尊敬するユーザー:',
				warnTip:
					'問題の考えられる原因である解決策については、サービス管理者に問い合わせることができます:',
				reason: 'ページ認証の時期が来ました',
				reason2: '管理者がこのページへのアクセスを許可していません',
			},
		}
		let i18nInfoHoteline = {
			zh: {
				title: '服务已到期',
				price: '查看版本与定价',
				respectfully: '尊敬的用户：',
				warnTip:
					'您好！目前产品版本的服务已到期，如需购买或延长服务期，请联系我们：',
				phone: '服务热线：400-1818-187',
				email: '客服邮箱：service@byteluck.com',
			},
			en: {
				title: 'Service Expired',
				price: 'View Version and Price',
				respectfully: 'Dear user:',
				warnTip:
					'Hello! The service of the current product version has expired. If you need to purchase or extend the service period, please contact us:',
				phone: 'Service hotline: 400-1818-187',
				email: 'Customer service email: service@byteluck.com',
			},
			ja: {
				title: 'サービスの有効期限',
				price: 'バージョンと価格の表示',
				respectfully: '尊敬するユーザー:',
				warnTip:
					'こんにちは。現在、製品バージョンのサービスが期限切れになっています。サービス期間を購入または延長する必要がある場合は、次のように連絡してください。',
				phone: 'サービスホットライン:400-1818-187',
				email: 'カスタマーサービスメール：service@byteluck.com',
			},
		}
		let serviceHotline = false
		//判断是否打开服务于热线
		function serviceInit() {
			const tenantDetail = localStorage.tenantDetail
			if (!tenantDetail) {
				return
			}
			const tenant_auth = JSON.parse(tenantDetail).data.tenant_auth
			const keys = Object.keys(tenant_auth)
			if (
				keys.some(
					a => a == 'service_hotline' && tenant_auth.service_hotline === 1
				)
			) {
				serviceHotline = true
			}
		}
		serviceInit()
		//判断是否打开服务于热线-未打开默认展示
		if (serviceHotline) {
			i18nInfo = i18nInfoHoteline
			document.getElementById('default_overdue').style.display = 'none'
			document.getElementById('showmore_overdue').style.display = 'block'
		}

		function formatLocale(value) {
			return value && value.slice(0, 2).toLocaleLowerCase()
		}

		function linkTo() {
			location.href = 'https://www.baiteda.com/price'
		}

		function updateI18nText(locale) {
			var languageObject = i18nInfo[locale]
			if (!languageObject) {
				document.body.style.visibility = 'visible'
				return
			}

			var i18nDomList = document.getElementsByClassName('i18n')
			Array.prototype.slice.call(i18nDomList).forEach(dom => {
				var i18nKey = dom.dataset['i18n']
				var newValue = languageObject[i18nKey]
				if (newValue) {
					dom.innerHTML = newValue
				}
			})
			document.body.style.visibility = 'visible'
		}
		updateI18nText(formatLocale(localStorage.locale))

		const phoneAndMail = document.getElementsByClassName('phoneAndMail')[0]
		const ptmY = document.getElementsByClassName('ptmY')[0]
		const ptmN = document.getElementsByClassName('ptmN')[0]
		if (
			JSON.parse(localStorage.getItem('tenantDetail')).data.tenant_auth
				.service_hotline
		) {
			//有热线
			phoneAndMail.style.display = 'block'
			ptmY.style.display = 'none'
			ptmN.style.display = 'block'
		} else {
			//无热线
			phoneAndMail.style.display = 'none'
			ptmY.style.display = 'block'
			ptmN.style.display = 'none'
		}
	</script>
</html>
